class Solution:
    def numTrees(self, n: int) -> int:
        dp = [0] * (n + 1) #创建空的列表
        dp[0] = 1
        dp[1] = 1 #列表初始化
        for i in range(2, n+1):
            for j in range(i+1):
                dp[i] += dp[j-1] * dp[i-j]
            #print(dp[i])
        print(dp)
        return dp[-1]

cs=Solution()
print(cs.numTrees(2))